package com.whmskj.xjlhbc.mobile.controller;

import com.whmskj.xjlhbc.core.AjaxResult;
import com.whmskj.xjlhbc.core.Page;
import com.whmskj.xjlhbc.domain.DailyProductionPerformanceReport;
import com.whmskj.xjlhbc.dto.JxQueryDto;
import com.whmskj.xjlhbc.service.IDailyProductionPerformanceReportService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Tag(name = "员工绩效",description = "员工绩效")
@RequestMapping("/jx")
public class JxController {

    @Autowired
    private IDailyProductionPerformanceReportService service;

    @GetMapping("/tj")
    @Operation(description = "统计")
    @ApiResponse(content = @Content(
            schema = @Schema(anyOf = {AjaxResult.class})
    ))
    public AjaxResult tj(JxQueryDto param){
        Object result = service.jxTj(param);
        return AjaxResult.success(result);
    }

    @GetMapping("/list")
    @Operation(description = "列表")
    @ApiResponse(content = @Content(
            schema = @Schema(anyOf = {AjaxResult.class, DailyProductionPerformanceReport.class})
    ))
    public AjaxResult list(JxQueryDto param){
        List<DailyProductionPerformanceReport> list = service.queryList(param);
        return Page.getDataTable(list);
    }

    @GetMapping("/userDetailList")
    @Operation(description = "员工绩效明细,必传名字和月份两个参数")
    @ApiResponse(content = @Content(
            schema = @Schema(anyOf = {AjaxResult.class, DailyProductionPerformanceReport.class})
    ))
    public AjaxResult userDetailList(JxQueryDto param){
        List<DailyProductionPerformanceReport> list = service.queryUserDetailList(param);
        return Page.getDataTable(list);
    }


}
